package cn.elwy.rcp.core.model.ui.entity;

import java.util.HashMap;
import java.util.Map;

/**
 * 表格头部信息类
 * 
 * @author huangsq
 * @version 1.0, 2013-11-20
 * @since 1.0, 2013-11-20
 */
public class Header {

  public static final int LEFT = 16384;
  public static final int TRAIL = 131072;
  public static final int RIGHT = 131072;
  public static final int CENTER = 16777216;

  /** 主键标识 */
  private Integer id;
  /** 用户ID */
  private Integer userId;
  /** 列表ID */
  private Integer listId;
  /** 显示名称 */
  private String name;

  private String columnCode;
  /** 宽度 */
  private Integer width = 100;
  /** 对齐方式 */
  private Integer align = LEFT;
  /** 是否可以调整宽度 */
  private Boolean isResizable = false;
  /** 是否显示 */
  private Boolean isVisible = false;
  /** 打印的时候是否打印此列 */
  private Boolean isPrintable = false;

  /** 对应的方法名称：用于反射 */
  private String method;
  /** 对应的方法名称：用于反射 */
  private Map<String, String> methods = new HashMap<String, String>();
  /** 输出格式使用的类 */
  private String formatClass;
  /** 输出格式 */
  private String formatPattern;
  /** 排序 */
  private Integer orderNo = 1;

  /**
   * 创建一个Header对象
   * 
   * @param name 显示名称
   * @param width 宽度
   * @param orderNo 列的次数
   */
  public Header(String name, Map<String, String> methods, int width, int orderNo) {
    this(name, null, width, orderNo, LEFT, true, true);
    this.methods = methods;
  }

  /**
   * 创建一个Header对象
   * 
   * @param name 显示名称
   * @param method 方法名称，如果有多个方法需要通过addMethod方法来添加
   * @param width 宽度
   * @param orderNo 列的次数
   */
  public Header(String name, String method, int width, int orderNo) {
    this(name, method, width, orderNo, LEFT, true, true);
  }

  /**
   * 创建一个Header对象
   * 
   * @param name 显示名称
   * @param method 方法名称，如果有多个方法需要通过addMethod方法来添加
   * @param width 宽度
   * @param orderNo 列的次数
   * @param align 对齐方式
   * @param isVisible 是否显示
   * @param isPrintable 是否可以打印
   */
  public Header(String name, String method, int width, int orderNo, int align, boolean isVisible, boolean isPrintable) {
    this.name = name;
    this.method = method;
    this.width = width;
    this.orderNo = orderNo;
    this.align = align;
    this.isVisible = isVisible;
    this.isPrintable = isPrintable;
  }

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public Integer getUserId() {
    return userId;
  }

  public void setUserId(Integer userId) {
    this.userId = userId;
  }

  public Integer getListId() {
    return listId;
  }

  public void setListId(Integer listId) {
    this.listId = listId;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getColumnCode() {
    return columnCode;
  }

  public void setColumnCode(String columnCode) {
    this.columnCode = columnCode;
  }

  public Integer getWidth() {
    return width;
  }

  public void setWidth(Integer width) {
    this.width = width;
  }

  public Integer getAlign() {
    return align;
  }

  public void setAlign(Integer align) {
    this.align = align;
  }

  public Boolean getIsResizable() {
    return isResizable;
  }

  public boolean isResizable() {
    return false;
  }

  public void setIsResizable(Boolean isResizable) {
    this.isResizable = isResizable;
  }

  public boolean isVisible() {
    return isVisible;
  }

  public Boolean getIsVisible() {
    return isVisible;
  }

  public void setIsVisible(Boolean isVisible) {
    this.isVisible = isVisible;
  }

  public boolean iIsPrintable() {
    return isPrintable;
  }

  public Boolean getIsPrintable() {
    return isPrintable;
  }

  public void setIsPrintable(Boolean isPrintable) {
    this.isPrintable = isPrintable;
  }

  public String getMethod() {
    return method;
  }

  public void setMethod(String method) {
    this.method = method;
  }

  public void addMethod(String key, String method) {
    methods.put(key, method);
  }

  public String getMethod(String key) {
    return methods.get(key);
  }

  public String getFormatClass() {
    return formatClass;
  }

  public void setFormatClass(String formatClass) {
    this.formatClass = formatClass;
  }

  public String getFormatPattern() {
    return formatPattern;
  }

  public void setFormatPattern(String formatPattern) {
    this.formatPattern = formatPattern;
  }

  public Integer getOrderNo() {
    return orderNo;
  }

  public void setOrderNo(Integer orderNo) {
    this.orderNo = orderNo;
  }

}